/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.andersen.web.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * @author Corvus 11
 */
@Controller
public class LoginController extends AbstractController{
   
   @RequestMapping(value = "/login-failure", method = RequestMethod.GET)
    public String loginFailure(ModelMap model) {
	
	model.put("login_failed", true);
		
	return "login";
    }
    
    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public String openLoginPage(ModelMap model, HttpServletRequest request) {
        
        if (request.getParameter("register_ok")!=null) {
            model.put("register_ok", request.getParameter("register_ok"));
            model.put("new_user_name", request.getParameter("new_user_name"));
            model.put("new_user_login", request.getParameter("new_user_login"));
        }
        
        return "login";
    }
}
